﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Foothill.Master" AutoEventWireup="true" 
    CodeBehind="EditProfile.aspx.cs" Inherits="Foothill.Web.UserProfile.EditProfile" ValidateRequest="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="stylesheet" href="edit-profile.css" type="text/css" />
    <script type="text/javascript" language="javascript">
        function startUpload(sender, args) {
            var filePath = args.get_fileName();
            if (filePath != "") {
                // code to get file extension..
                var arr1 = new Array;
                arr1 = filePath.split("\\");
                var len = arr1.length;
                var fileName = arr1[len - 1];
                var filext = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();

                if (filext == "jpg" || filext == "jpeg" || filext == "gif" || filext == "png" || filext == "bmp")
                    return true;
                else {
                    alert("Invalid File Format Selected");
                    return false;
                }
            }
        }

        function uploadComplete(sender, args) {
            location.reload(true);
        }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cph1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div id="edit-profile">
        <div id="edit-top">
            <asp:Label ID="lblUserName" runat="server" CssClass="lblUserName" />  
            <div class="clear"></div>
        </div>  
        <table id="tbl-edit-profile">
            <tr>
                <td class="td-label"><asp:Label ID="lblProfilePhoto" runat="server" meta:resourcekey="lblProfilePhoto" /></td>   
                <td>
                    <div>
                        <asp:Image ID="imgProfile" runat="server" CssClass="imgProfile" />
                    </div>
                    <div class="photoUpload">
                        <ajaxToolkit:AsyncFileUpload runat="server" ID="ProfileUploader" OnClientUploadStarted="startUpload" OnClientUploadComplete="uploadComplete"
                            OnUploadedComplete="ProfileUploader_UploadedComplete" CssClass="LogoUploader" />
                    </div>  
                </td>  
            </tr>
            <tr>
                <td class="td-label">
                    <asp:Label ID="lblLogo" runat="server" meta:resourcekey="lblLogo" /></td>
                <td>
                    <div>
                        <asp:Image ID="imgLogo" runat="server" CssClass="imgLogo" />
                    </div>
                    <div class="photoUpload">
                        <ajaxToolkit:AsyncFileUpload runat="server" ID="LogoUploader" OnClientUploadStarted="startUpload" OnClientUploadComplete="uploadComplete"
                            OnUploadedComplete="LogoUploader_UploadedComplete" CssClass="LogoUploader" />

                    </div>
                </td>
            </tr>
            <tr>
                <td class="td-label"><asp:Label ID="lblContactName" runat="server" meta:resourcekey="lblContactName" /></td>  
                <td>
                    <asp:TextBox ID="txtContactName" runat="server" CssClass="input-box" />
                </td>   
            </tr>
            <tr>
                <td class="td-label"><asp:Label ID="lblPhone" runat="server" meta:resourcekey="lblPhoneNumber" /></td>    
                <td>
                    <asp:TextBox ID="txtPhone" runat="server" CssClass="input-box" />
                </td>
            </tr>
            <tr>
                <td class="td-label"><asp:Label ID="lblIntro" runat="server" meta:resourcekey="lblIntro" /></td>  
                <td>
                    <asp:TextBox ID="tbxIntro" runat="server" TextMode="MultiLine" Rows="8" CssClass="tbxIntro" />    
                    <ajaxToolkit:HtmlEditorExtender ID="hee1" runat="server" TargetControlID="tbxIntro" 
                        DisplaySourceTab="False" EnableSanitization="false">
                        <Toolbar> 
                            <ajaxToolkit:Bold />
                            <ajaxToolkit:Italic />
                            <ajaxToolkit:Underline />
                            <ajaxToolkit:ForeColorSelector />
                        </Toolbar>
                    </ajaxToolkit:HtmlEditorExtender>
                </td>     
            </tr>
            <tr>
                <td />
                <td>
                    <asp:LinkButton ID="btnSaveProfile" runat="server" OnClick="SaveProfile" 
                        meta:resourcekey="btnSaveProfile" CssClass="btnSaveProfile" />
                    <asp:Label ID="lblFeedback" runat="server" />     
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
